//
//  HomemyViewCell.m
//  geiTA
//
//  Created by duyan on 14-11-20.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "HomemyViewCell.h"
#import "HomeModel.h"
#import "UIImageView+WebCache.h"
@implementation HomemyViewCell
- (void)dealloc
{
    [_image release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.image = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
        [self.image setBackgroundColor:[UIColor redColor]];
        [self addSubview:_image];
        [self addObserver:self forKeyPath:@"model" options:NSKeyValueObservingOptionNew context:nil];
        [_image release];
    }
    return self;
}

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    if ([keyPath isEqualToString:@"model"]) {
        [self.image setImageWithURL:[NSURL URLWithString:_model.cover_image_url]];
    }
}


@end
